package com.zzyl.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.zzyl.base.PageResponse;
import com.zzyl.entity.NursingProject;
import com.zzyl.mapper.NursingMapper;
import com.zzyl.service.NursingService;
import com.zzyl.vo.NursingProjectVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 护理模块的业务层
 */
@Service
public class NursingServiceImpl implements NursingService {

    @Autowired
    private NursingMapper nursingMapper;


    /**
     * 分页查询
     * @param name
     * @param pageNum
     * @param pageSize
     * @param status
     * @return
     */
    @Override
    public PageResponse selectByPage(String name, Integer pageNum, Integer pageSize, Integer status) {
        PageHelper.startPage(pageNum,pageSize);
        NursingProject nursingProject = NursingProject.builder().name(name).status(status).build();
        Page<NursingProjectVO> nursingProjects = nursingMapper.list(nursingProject);
        return PageResponse.of(nursingProjects,NursingProjectVO.class);
    }
}
